﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using POSSystem.DAL;

namespace POSSystem.BLL
{
    public class View_Products : _View_Products
    {
        public static View_Products LoadAllActiveProducts()
        {
            try
            {
                View_Products p = new View_Products();
                p.LoadAll();
                return p;
            }
            catch (Exception e)
            {
                ErrorLog.WriteToFile("Products.cs", "GetAllActiveProducts", e.StackTrace);
                throw e;
            }
        }

        public static View_Products LoadByProductID(int id)
        {
            try
            {
                View_Products p = new View_Products();
                p.Where.ID.Value = id;
                p.Query.Load();

                return p;
            }
            catch (Exception e)
            {
                ErrorLog.WriteToFile("Products.cs", "GetAllActiveProducts", e.StackTrace);
                throw e;
            }
        }
    }
}
